package zhongbo.java.air.airmonitor.listener;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class RedisLogChanelPublisher {
    @Autowired
    private RedisTemplate<String, Object> redisTemplate;

    // 发布消息
    public void publishMessage(String channel, String message){
        log.info("向频道 [{}] 发送Json航迹数据: {}", channel, message);// 向指定channel发送消息
        redisTemplate.convertAndSend(channel, message);
    }
}
